package it.trekker.upload.json;

import java.io.Serializable;


public class PoiUploaded implements Serializable {

	private long id;
	private GPSCoordinateUploaded location;
	private String friendlyName;
	private long excursionId;
	
	
	public PoiUploaded() {
		this(null,  null);
	}
	
	public PoiUploaded(GPSCoordinateUploaded location) {
		this(location, null);
	}
	
	public PoiUploaded(GPSCoordinateUploaded location, String friendlyName) {
		this.location = location;
		this.friendlyName = friendlyName;
		this.id = -1;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public GPSCoordinateUploaded getLocation() {
		return location;
	}
	
	public void setLocation(GPSCoordinateUploaded location) {
		this.location = location;
	}
	
	public String getFriendlyName() {
		return friendlyName;
	}
	
	public void setFriendlyName(String friendlyName) {
		this.friendlyName = friendlyName;
	}
	
	public long getExcursionId() {
		return excursionId;
	}

	public void setExcursionId(long excursionId) {
		this.excursionId = excursionId;
	}

	@Override
	public String toString() {
		return String.format("POI::%s (lat: %f, long: %f, alt: %f, exc: %d)", friendlyName,
				location.getLatitude(), location.getLatitude(), location.getAltitude(), excursionId);
	}
	
	@Override
	public boolean equals(Object o) {
		if(o == null)
			return false;
		if(this == o)
			return true;
		if(!(o instanceof PoiUploaded))
			return false;
		
		PoiUploaded otherPoi = (PoiUploaded)o;
		
		if(!this.friendlyName.equals(otherPoi.friendlyName))
			return false;
		if(!this.location.equals(otherPoi.location))
			return false;
		
		return true;
	}
	
}
